package cn.doitedu.dwetl.utls

import com.alibaba.fastjson.JSON
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.SparkSession

/**
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @Author hunter@doitedu.cn
 * @date 2020/8/217:29     
 */
object BindTableUtil {

  def loadBindTable(spark: SparkSession, dt: String): RDD[(String, String)] = {
    val bindTable = spark.read.textFile(s"/idmp/bindtable/${dt}")
    bindTable.rdd.map(line => {
      val obj = JSON.parseObject(line)
      val deviceid = obj.getString("deviceid")
      val guid = obj.getString("guid")
      (deviceid, guid)
    }
    )
  }

}
